using System.Buffers;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class UpgradeRepairingReload:Upgrade {


	protected override void ReloadingEventHandler(object _sender,ReloadEventArgs e) {
		base.ReloadingEventHandler(_sender,e);
		float ammoAdded = e.ammoAdded;
		if(ammoAdded<0) ammoAdded=0;
		if(weapon.owner.energy<ammoAdded) ammoAdded=weapon.owner.energy;
		int healNeeded = (int)(weapon.owner._maxHP-weapon.owner.HP);
		if(ammoAdded>healNeeded) ammoAdded=healNeeded;
		weapon.owner.energy-=ammoAdded;
		weapon.owner.Damage(new DamageStats(-ammoAdded,_damageType: DamageType.Healing));
	}

}
